﻿// Copyright: 2012 
// Author: Minh Vu - YoungJ
// File name: VisiableButonConverter.cs
// Solution: WpfEncryption
// Project: WpfEncryption
// Time: 2:09 PM 31/05/2012

using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;

namespace WpfEncryption.Converter
{
    public class VisiableButonConverter : IMultiValueConverter
    {
        #region Implementation of IValueConverter

        public object Convert(object[] value, Type targetType, object parameter, CultureInfo culture)
        {
            var text = value[0].ToString();
            var isfile = System.Convert.ToBoolean(value[1]);
            var visible = System.Convert.ToBoolean(value[2]);
            if (string.IsNullOrEmpty(text)) return Visibility.Collapsed;
            if (text.ToLower().Contains("file too larger") && isfile && visible)
                return Visibility.Visible;
            return Visibility.Collapsed;
        }

        public object[] ConvertBack(object value, Type[] targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}